/**
 * Definition for singly-linked list.
 * function ListNode(val, next) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.next = (next===undefined ? null : next)
 * }
 */
/**
 * @param {ListNode} head
 * @return {ListNode}
 */

 let {list,ListNode}=require('./lianbiao');

   

 /* var deleteDuplicates = function(head) {
    if(!head || !head.next){
        return head;
    }
    let newhead =  new ListNode();
    newhead.next=head;
    let newheadnode=newhead;
    let node = head;
    while(node!=null){
        let v = node.val;
        while(node!=null && node.val==v){
            node=node.next;
        }
        console.log(node,'--');
        if(newheadnode.next.next==node){
            newheadnode=newheadnode.next;
            // console.log('==',newheadnode);
            
        }
        else{
            newheadnode.next=node;
        }    
        console.log(newhead);
    }
    return newhead.next;
}; */

let arr=[1,2,3,3,4,4,5];
let head=list(arr);
console.log(deleteDuplicates(head));